﻿
<template>
<div class="card-fill layout-padding">
<el-card shadow="hover" class="layout-padding-auto" >
  <div>
    <el-form ref="formRefProcessRouteItem" :model="stateProcessRouteItem.vmModel" label-width="100px">
      <el-row>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_RoutieId_FormItem" prop="Entity.RoutieId" :label="$t('message.autotrans._Model_ProcessRouteItem_Routie')">
            <el-select v-model="stateProcessRouteItem.vmModel.Entity.RoutieId" disabled clearable>
               <el-option v-for="item in stateProcessRouteItem.AllRouties" :key="item.Value" :value="item.Value" :label="item.Text"></el-option>
            </el-select>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_GroupCode_FormItem" prop="Entity.GroupCode" :label="$t('message.autotrans._Model_ProcessRouteItem_GroupCode')">
            <el-input v-model="stateProcessRouteItem.vmModel.Entity.GroupCode" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_OpCode_FormItem" prop="Entity.OpCode" :label="$t('message.autotrans._Model_ProcessRouteItem_OpCode')"            :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_ProcessRouteItem_OpCode')}), trigger: 'blur' }]" >
            <el-input v-model="stateProcessRouteItem.vmModel.Entity.OpCode" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_OpName_FormItem" prop="Entity.OpName" :label="$t('message.autotrans._Model_ProcessRouteItem_OpName')"            :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_ProcessRouteItem_OpName')}), trigger: 'blur' }]" >
            <el-input v-model="stateProcessRouteItem.vmModel.Entity.OpName" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_OpType_FormItem" prop="Entity.OpType" :label="$t('message.autotrans._Model_ProcessRouteItem_OpType')"            :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_ProcessRouteItem_OpType')}), trigger: 'blur' }]" >
            <el-select v-model="stateProcessRouteItem.vmModel.Entity.OpType" disabled clearable>
               <el-option key="Assembling" value="Assembling" :label="$t('message.autotrans._Enum_OpTypeEnum_Assembling')"></el-option>
               <el-option key="Detection" value="Detection" :label="$t('message.autotrans._Enum_OpTypeEnum_Detection')"></el-option>
               <el-option key="Rework" value="Rework" :label="$t('message.autotrans._Enum_OpTypeEnum_Rework')"></el-option>
               <el-option key="TakePartInOrOut" value="TakePartInOrOut" :label="$t('message.autotrans._Enum_OpTypeEnum_TakePartInOrOut')"></el-option>
               <el-option key="Weild" value="Weild" :label="$t('message.autotrans._Enum_OpTypeEnum_Weild')"></el-option>
               <el-option key="PrintMark" value="PrintMark" :label="$t('message.autotrans._Enum_OpTypeEnum_PrintMark')"></el-option>
               <el-option key="Fds" value="Fds" :label="$t('message.autotrans._Enum_OpTypeEnum_Fds')"></el-option>
            </el-select>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_ErpOpCode_FormItem" prop="Entity.ErpOpCode" :label="$t('message.autotrans._Model_ProcessRouteItem_ErpOpCode')">
            <el-input v-model="stateProcessRouteItem.vmModel.Entity.ErpOpCode" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_StdOpDuration_FormItem" prop="Entity.StdOpDuration" :label="$t('message.autotrans._Model_ProcessRouteItem_StdOpDuration')"            :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_ProcessRouteItem_StdOpDuration')}), trigger: 'blur' }]" >
            <el-input v-model="stateProcessRouteItem.vmModel.Entity.StdOpDuration" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_StdPrepDuration_FormItem" prop="Entity.StdPrepDuration" :label="$t('message.autotrans._Model_ProcessRouteItem_StdPrepDuration')">
            <el-input v-model="stateProcessRouteItem.vmModel.Entity.StdPrepDuration" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_PolicyCheckPrevProc_FormItem" prop="Entity.PolicyCheckPrevProc" :label="$t('message.autotrans._Model_ProcessRouteItem_PolicyCheckPrevProc')"            :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_ProcessRouteItem_PolicyCheckPrevProc')}), trigger: 'blur' }]" >
            <el-select v-model="stateProcessRouteItem.vmModel.Entity.PolicyCheckPrevProc" disabled clearable>
               <el-option key="None" value="None" :label="$t('message.autotrans._Enum_PolicyCheckPrevProcEnum_None')"></el-option>
               <el-option key="Worked" value="Worked" :label="$t('message.autotrans._Enum_PolicyCheckPrevProcEnum_Worked')"></el-option>
               <el-option key="WorkedAndOK" value="WorkedAndOK" :label="$t('message.autotrans._Enum_PolicyCheckPrevProcEnum_WorkedAndOK')"></el-option>
            </el-select>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_PolicyCheckProcBom_FormItem" prop="Entity.PolicyCheckProcBom" :label="$t('message.autotrans._Model_ProcessRouteItem_PolicyCheckProcBom')"            :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_ProcessRouteItem_PolicyCheckProcBom')}), trigger: 'blur' }]" >
            <el-select v-model="stateProcessRouteItem.vmModel.Entity.PolicyCheckProcBom" disabled clearable>
               <el-option key="None" value="None" :label="$t('message.autotrans._Enum_PolicyCheckProcBomEnum_None')"></el-option>
               <el-option key="Over" value="Over" :label="$t('message.autotrans._Enum_PolicyCheckProcBomEnum_Over')"></el-option>
            </el-select>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_PolicyCheckProcess_FormItem" prop="Entity.PolicyCheckProcess" :label="$t('message.autotrans._Model_ProcessRouteItem_PolicyCheckProcess')"            :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_ProcessRouteItem_PolicyCheckProcess')}), trigger: 'blur' }]" >
            <el-select v-model="stateProcessRouteItem.vmModel.Entity.PolicyCheckProcess" disabled clearable>
               <el-option key="AllowedEntryRepeat" value="AllowedEntryRepeat" :label="$t('message.autotrans._Enum_PolicyCheckProcessEnum_AllowedEntryRepeat')"></el-option>
               <el-option key="CheckBOMSource" value="CheckBOMSource" :label="$t('message.autotrans._Enum_PolicyCheckProcessEnum_CheckBOMSource')"></el-option>
            </el-select>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_CtlAttr_FormItem" prop="Entity.CtlAttr" :label="$t('message.autotrans._Model_ProcessRouteItem_CtlAttr')"            :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_ProcessRouteItem_CtlAttr')}), trigger: 'blur' }]" >
            <el-select v-model="stateProcessRouteItem.vmModel.Entity.CtlAttr" disabled clearable>
               <el-option key="Must" value="Must" :label="$t('message.autotrans._Enum_ProcCtlAttrEnum_Must')"></el-option>
               <el-option key="Optional" value="Optional" :label="$t('message.autotrans._Enum_ProcCtlAttrEnum_Optional')"></el-option>
            </el-select>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_Pos_FormItem" prop="Entity.Pos" :label="$t('message.autotrans._Model_ProcessRouteItem_Pos')"            :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_ProcessRouteItem_Pos')}), trigger: 'blur' }]" >
            <el-input v-model="stateProcessRouteItem.vmModel.Entity.Pos" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_Etag_FormItem" prop="Entity.Etag" :label="$t('message.autotrans._Model_ProcessRouteItem_Etag')">
            <el-input v-model="stateProcessRouteItem.vmModel.Entity.Etag" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_Active_FormItem" prop="Entity.Active" :label="$t('message.autotrans._Model_ProcessRouteItem_Active')"            :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_ProcessRouteItem_Active')}), trigger: 'blur' }]" >
            <el-input v-model="stateProcessRouteItem.vmModel.Entity.Active" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_EquipmentId_FormItem" prop="Entity.EquipmentId" :label="$t('message.autotrans._Model_ProcessRouteItem_EquipmentId')">
            <el-input v-model="stateProcessRouteItem.vmModel.Entity.EquipmentId" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_EquipmentCode_FormItem" prop="Entity.EquipmentCode" :label="$t('message.autotrans._Model_ProcessRouteItem_EquipmentCode')">
            <el-input v-model="stateProcessRouteItem.vmModel.Entity.EquipmentCode" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_Aux_1_FormItem" prop="Entity.Aux_1" :label="$t('message.autotrans._Model_ProcessRouteItem_Aux_1')">
            <el-input v-model="stateProcessRouteItem.vmModel.Entity.Aux_1" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_Aux_2_FormItem" prop="Entity.Aux_2" :label="$t('message.autotrans._Model_ProcessRouteItem_Aux_2')">
            <el-input v-model="stateProcessRouteItem.vmModel.Entity.Aux_2" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_CreateTime_FormItem" prop="Entity.CreateTime" :label="$t('message.autotrans._Model_ProcessRouteItem_CreateTime')">
            <el-input v-model="stateProcessRouteItem.vmModel.Entity.CreateTime" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_UpdateTime_FormItem" prop="Entity.UpdateTime" :label="$t('message.autotrans._Model_ProcessRouteItem_UpdateTime')">
            <el-input v-model="stateProcessRouteItem.vmModel.Entity.UpdateTime" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_CreateBy_FormItem" prop="Entity.CreateBy" :label="$t('message.autotrans._Model_ProcessRouteItem_CreateBy')">
            <el-input v-model="stateProcessRouteItem.vmModel.Entity.CreateBy" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_UpdateBy_FormItem" prop="Entity.UpdateBy" :label="$t('message.autotrans._Model_ProcessRouteItem_UpdateBy')">
            <el-input v-model="stateProcessRouteItem.vmModel.Entity.UpdateBy" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_IsValid_FormItem" prop="Entity.IsValid" :label="$t('message.autotrans._Model_ProcessRouteItem_IsValid')"            :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_ProcessRouteItem_IsValid')}), trigger: 'blur' }]" >
            <el-input v-model="stateProcessRouteItem.vmModel.Entity.IsValid" disabled clearable></el-input>
        </el-form-item>

        </el-col>
      </el-row>

      <div style="text-align:right;">
        <WtmButton @click="onCloseProcessRouteItem"  type="primary" :button-text="$t('message.autotrans.SysClose')" style="margin-top:15px;"/>

      </div>

    </el-form>

  </div>

</el-card>
</div>
</template>


<script setup lang="ts" name="message.autotrans._PageProcessManagementProcessRouteItemDetails;false">
import {  ElMessageBox, ElMessage,ElLoading } from 'element-plus';
import { defineAsyncComponent,reactive, ref, getCurrentInstance, onMounted, nextTick } from 'vue';
import { processrouteitemApi } from '/@/api/processmanagement/processrouteitem';
import other from '/@/utils/other';
import fileApi from '/@/api/file';
import { useRouter } from "vue-router";
const ci = getCurrentInstance() as any;


// 定义变量内容
const formRefProcessRouteItem = ref();
const stateProcessRouteItem = reactive({
    vmModel: {
	  Entity:{
        RoutieId: null,
        GroupCode: '',
        OpCode: '',
        OpName: '',
        OpType: undefined,
        ErpOpCode: '',
        StdOpDuration: null,
        StdPrepDuration: null,
        PolicyCheckPrevProc: undefined,
        PolicyCheckProcBom: undefined,
        PolicyCheckProcess: undefined,
        CtlAttr: undefined,
        Pos: null,
        Etag: '',
        Active: undefined,
        EquipmentId: null,
        EquipmentCode: '',
        Aux_1: '',
        Aux_2: '',
        CreateTime: undefined,
        UpdateTime: undefined,
        CreateBy: '',
        UpdateBy: '',
        IsValid: undefined,
        ID:null,
      },

	},
    
    AllRouties: [] as any[],
});

// 取消
const onCloseProcessRouteItem = () => {
    closeDialog();
};

// 提交
const onSubmitProcessRouteItem = () => {
 	const loadingInstance = ElLoading.service({
		lock: true,
		text: '正在提交中，请等待。。。',
		background: 'rgba(0, 0, 0, 0.7)',
	});
   formRefProcessRouteItem.value?.validate((valid: boolean, fields: any) => {
		if (valid) {
            processrouteitemApi().edit(stateProcessRouteItem.vmModel).then(() => {
                ElMessage.success(ci.proxy.$t('message._system.common.vm.submittip'));
                emit('refresh');
                closeDialog();
            }).catch((error) => {
                other.setFormError(ci, error);
            }).finally(() => {
			loadingInstance.close();
		    })
		}
        else{
			loadingInstance.close();
        }
	})
};

// 页面加载时
onMounted(() => {
    
    other.getSelectList('/api/ProcessManagement/ProcessRouteItem/GetProcessRoutes',[],false).then(x=>{stateProcessRouteItem.AllRouties = x});
    if (ci.attrs["wtmdata"]) {
		stateProcessRouteItem.vmModel.Entity.ID = ci.attrs["wtmdata"].ID;
	}
	else if (useRouter().currentRoute.value.query.id) {
		stateProcessRouteItem.vmModel.Entity.ID = useRouter().currentRoute.value.query.id as any;
	}
	processrouteitemApi().get(stateProcessRouteItem.vmModel.Entity.ID ?? "").then((data: any) => other.setValue(stateProcessRouteItem.vmModel, data));
});

// 定义子组件向父组件传值/事件
const emit = defineEmits(['refresh','closeDialog']);
// 关闭弹窗
const closeDialog = () => {
    emit('closeDialog');
};
// 暴露变量
defineExpose({

});
</script>

<style scoped lang="scss">

</style>

